﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdBrShellFaceTraverser : OdBrTraverser
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdBrShellFaceTraverser(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdBrShellFaceTraverser_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdBrShellFaceTraverser obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdBrShellFaceTraverser()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdBrShellFaceTraverser(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdBrFace getFace()
		{
			OdBrFace result = new OdBrFace(GlobalsPINVOKE.OdBrShellFaceTraverser_getFace(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrShell getShell()
		{
			OdBrShell result = new OdBrShell(GlobalsPINVOKE.OdBrShellFaceTraverser_getShell(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setShell(OdBrShell shell)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrShellFaceTraverser_setShell(this.swigCPtr, OdBrShell.getCPtr(shell));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setFace(OdBrFace face)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrShellFaceTraverser_setFace(this.swigCPtr, OdBrFace.getCPtr(face));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setShellAndFace(OdBrFace face)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrShellFaceTraverser_setShellAndFace(this.swigCPtr, OdBrFace.getCPtr(face));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrShellFaceTraverser() : this(GlobalsPINVOKE.new_OdBrShellFaceTraverser(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
